package com.example.myapplication;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.widget.ListView;
import android.widget.SimpleAdapter;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class fuwuActivity2 extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_fuwu2);
                initlistitim();
            }

           private void initlistitim() {
                ListView listView = findViewById(R.id.fulist_id);
                List<Map<String, Object>> datalist = new ArrayList<>();
                Map<String, Object> item = new HashMap<>();
                datalist.add(item);
                SimpleAdapter adapter =
                        new SimpleAdapter(this, datalist,
                                R.layout.fuwu_list,
                                new String[]{"tou","name"},
                                new int[]{R.id.list_item_touxiang,R.id.list_item_name});

                // //4.将适配器赋值给ListView
                listView.setAdapter(adapter);
            }

        }
